1. Field of the Invention
The present invention relates to integrated circuits having a non-volatile memory for storing sequences of instructions for execution by a processor on the integrated circuit; and more to particularly to techniques for accomplishing in-circuit programming to update and modify the stored sequences of instructions.
2. Description of Related Art
Integrated circuit microcontrollers have been developed which include arrays of non-volatile memory on the chip for storing sequences of instructions to be executed by the microcontroller. The sequences of instructions can be stored in read only memory (ROM) which must be programmed during manufacturing of the device, and cannot be updated. In an alternative approach, the instructions can be stored in an EPROM array. These types of devices require a special programming device to be used to program the EPROM array before the device is placed in the circuit. In yet other systems, EEPROM memory can be sued for storing the instructions. EEPROM can be programmed much more quickly than EPROM, and can be modified on the fly. Also, flash memory can be utilized, which allows for higher density and higher speed reprogramming of the non-volatile memory storing instructions. When the non-volatile memory is reprogrammable, such as EEPROM or flash memory, and it is combined with a microcontroller, the reprogramming of the device can be accomplished while the device is in the circuit, allowing in circuit programming based on interactive algorithms.
For example, in the Internet environment, the ability to interactively download instruction sets and data to a remote device can be very valuable. For example, a company can provide service to customers without requiring the customer to bring the product back to a service center. Rather, the company can execute diagnostic functions using the in-circuit programming capability of the customer""s device, across a communication channel, such as the Internet or telephone lines. Software fixes can be downloaded to the customer, and the product can be reenabled with corrected or updated code.
Example prior devices which include this capability include the AT89S8252 microcontroller, manufactured by Atmel of San Jose, Calif., and the P83CE558 single chip microcontroller, manufactured by Phillips Semiconductors of Eindhoven, The Netherlands. According to the architecture of the Philips P83CE558 microcontroller, mask ROM is utilized for the in-circuit programming ICP set of instructions, which are used for updating flash memory on the chip. Thus, the Philips microcontroller requires a dedicated mask ROM module to store fixed ICP code for each individual environment. In order to adapt the ICP code for a particular environment, the environment must be known before manufacturing is complete of the device so the mask ROM can be coded. Furthermore, the ICP communications channel is fixed to a serial RS232 port in the Philips microcontroller. The limitation to a serial port limits the application of the microcontroller to relatively narrow range of potential applications, and makes it difficult to utilize the ICP function in a dynamic communication environment where the serial port may not match well with the communication channel on which the updated software is provided.
According to the architecture of the Atmel AT89S8252 microcontroller, a dedicated Serial Peripheral Interface (SPI) port on the chip is used for the updating of flash memory storing dynamically alterable instructions. Program logic is associated with the SPI port, and therefore is inflexible. Furthermore, modification of the in-circuit programming technique cannot be done because of the hardware dedication to the SPI port. Further disadvantages of the Atmel chip include that complicated hardware used for handshaking with the ICP initiator and emulating the erase/program/verify waveform for the flash memory must be added to the chip; that the SPI bus limitation is not always the best choice in diverse system applications, and that extra system logic is required to modify original reset circuits, which are implicated by the in-circuit programming algorithm. Further, complex SPI driver and receiver logic is required outside the chip in the system using the Atmel microcontroller.
Accordingly in-circuit programming structures have been developed which rely on flash memory or other dynamically alterable non-volatile memory. However, prior art approaches have been inflexible in the in-circuit algorithms used. Thus, in dynamic networking environments where communication requirements can change, and applications of devices using the in-circuit programming can proliferate through a wide variety of circumstances, it""s desirable to provide more flexible in-circuit programming capability. Furthermore, the in-circuit programming capability must insure that no instructions are lost during the in-circuit programming process, even if the power is turned off during the process. The technique must allow for interactive communication with a remote partner to accomplish the in-circuit programming process. These techniques must be available over a wide variety of media, including the Intel/Microsoft/Digital standard Universal Serial Bus (USB), the Philips Electronics/Computer Access Technology standard Access Bus, the Apple Computer/IBM/ATandT standard Geoport, the Apple Computer/Texas Instruments/NCR standard 1349 Fire Wire, the Internet, a serial port (such as RS232), and other environments.
Thus, it is desirable to provide more flexible in-circuit programming structures for use with integrated circuits.
The present invention provides an architecture for an integrated circuit supporting in-circuit programming, which allows for dynamically altering the in-circuit programming instruction set itself, as well as other software stored on the chip. This greatly expands the usability of in-circuit programming devices to a wide variety of communication environments, supporting serial ports, parallel ports, telephone communications, Internet communications, and other communication protocols as suits the needs of a particular system. The invention is based on a microcontroller or other instruction executing processor on an integrated circuit having an embedded non-volatile memory array which stores instructions, including an in-circuit programming instruction set. Using a control program stored on the device, the device interactively establishes an in-circuit programming exchange with a remote partner, and updated data and software, including the in-circuit programming sequence, when needed. For example, a self-updating algorithm, according to the present invention, proceeds as follows:
1. The device receives an in-circuit programming request.
2. The initiator is identified.
3. The device returns an identifier back to the initiator of the request.
4. The information exchange proceeds when the parties have been successfully identified.
5. In order to begin the in-circuit programming, execution of the program jumps to an in-circuit programming routine in the non-volatile memory on the chip.
6. The in-circuit programming routine mirrors itself or at least an ICP kernel, to another bank of memory on the chip.
7. The in-circuit programming software disables itself and wakes up using the mirrored ICP sequence.
8. The mirrored ICP sequence downloads new in-circuit programming software to the original ICP location.
9. The mirrored ICP sequence disables itself, and wakes up with the new ICP software in the original flash array.
10. Normal program execution is then resumed.
New instructions and data for other parts of software stored in the flash memory device can be executed at numerous places in the sequences, relying on the original ICP code, the mirrored ICP code, or the new ICP code after it has been activated.
Accordingly, the present invention can be characterized as an apparatus for in=circuit programming of an integrated circuit having a processor which executes a program of instructions. The apparatus comprises a first memory array, comprising non-volatile memory cells, on the integrated circuit which stores instructions for execution by the processor, including in-circuit programming set of instructions. A second memory array also comprising non-volatile memory cells in preferred systems, is provided on the integrated circuit. One or more external ports is provided on the integrated circuit by which data is received from an external source. Control logic, including the processor and a kernel in the ICP code, is responsive to an in-circuit programming update command to write a copy of the in-circuit programming set from the first memory array to the second memory array, and to cause the processor to execute the in-circuit programming set from the second memory array to program the non-volatile memory cells of the first memory array with data from the external port.
According to one aspect of the invention, the first memory array comprises a plurality of separately erasable blocks of non-volatile memory cells and the in-circuit programming set is stored in a particular block, During execution of the in-circuit programming set, the particular block is modified to generate a new in-circuit programming set. Then the control logic causes the processor to execute the new in-circuit programming set from the first memory array.
According to yet another aspect of the invention, the integrated circuit includes a plurality of ports to external data sources, such as one or more serial ports, one or more parallel ports, and potentially one or more specialized communication ports. The port in the plurality of ports, as used for the external port during execution of the in-circuit programming set, is determined by the instructions in the in-circuit programming set itself, and thus, can be dynamically altered in one preferred embodiment of the present invention.
According to another aspect of the invention, the integrated circuit includes a data path for programming and verifying the first memory array and optionally, the second memory array, independent of the in-circuit programming set of instructions. Thus, using multiplexed I/O pins or the like, original software can be loaded onto the device during manufacture or prior to mounting the chip into the system. In order to modify the original code, the in-circuit programming process is utilized.
The present invention can also be characterized as a controller on an integrated circuit that includes a processor on the integrated circuit which executes instructions received at an instruction input to the processor module. First and second memory arrays of non-volatile memory cells are provided on the integrated circuit. The first memory array stores the in-circuit programming set of instructions in a particular block of non-volatile cells. An external port is provided on the integrated circuit by which data is received from an external source. Control logic, including the processor and a kernel in the ICP code, is responsive to an in-circuit programming update command to write a copy of the in-circuit programming set from the first memory array to the second memory array, and to cause the in-circuit programming set from the second memory to program the non-volatile memory cells of the first memory array with data received from external port. Data paths on the integrated circuit are provided for programming and verifying the first memory array, independent of the in-circuit programming set. The external port comprises in alternative embodiments, a serial port and a parallel port. In yet another embodiment, there are a plurality of external ports on the device, and the one selected for use during the in-circuit programming sequence is specified by the in-circuit programming software itself.
Accordingly, a method for in-circuit programming of an integrated circuit having a processor which executes a program of instructions is provided. The method includes:
1. providing on the integrated circuit a first erasable and programmable read only memory array and a second erasable and programmable read only memory array;
2. storing an in-circuit programming set of instructions in the first array;
3. receiving an in-circuit program command from an initiator external to the integrated circuit;
4. in response to the in-circuit program command, copying the in-circuit programming set from the first array to the second array, and executing with the processor the in-circuit programming set from the second array;
5. programming at least a selected portion of the first array with data from an external source under control of the in-circuit programming set; and
6. after programming the portion of the first array, executing with the processor the in-circuit programming set from the first array.
According to another aspect of the present invention, the method includes storing the in-circuit programming set in the selected portion of the first memory array. Alternatively, the method can include the step of determining from the initiator whether the in-circuit programming sequence, indicated by the in-circuit programming command, includes modifying the in-circuit programming set. If the sequence does include the modification, then the step of copying and executing is carried out. If not, then the step of copying and executing is skipped, and the algorithm proceeds directly to programming the instructions and data in other portions of the memory array.
In sum, the present invention provides an in-circuit programming technique which allows for dynamic alternation of the in-circuit programming sequences of instructions. This enables the use of the device in a wide variety of environments, and in dynamically changing environments. For example, if a communication protocol is updated, then the in-circuit programming sequence of instructions itself may need modification. According to the present invention, a microcontroller can be placed in the field and dynamically updated as communication protocols are improved or speeds are increased. Furthermore, the device can be adapted for a wide variety of communications ports, allowing more widespread application of the microcontroller with in-circuit programming capability.
Other aspects and advantages of the present invention can be seen upon review of the figures, the detailed description, and the claims that follow.